var a = getApp();

Page({
    data: {
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        memberId: 0,
        listData: []
    },
    initData: function() {
        this.data.page = 1, this.data.isLoadMore = !0, this.data.total_page = 0;
    },
    getData: function() {
        var t = this;
        this.initData();
        var e = a.getNetAddresss("plugin.room.frontend.live.get-fans-list");
        a._getNetWork({
            url: e,
            data: {
                anchor_member_id: this.data.memberId
            },
            success: function(a) {
                var e = a.data;
                t.setData({
                    listData: e.data.data
                }), t.data.isLoadMore = !0, t.data.total_page = e.data.last_page, t.data.total_page || (t.data.total_page = 0);
            }
        });
    },
    _getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var e = a.getNetAddresss("plugin.room.frontend.live.get-fans-list");
            a._postNetWork({
                url: e,
                data: {
                    page: this.data.page,
                    anchor_member_id: this.data.memberId
                },
                success: function(a) {
                    var e = a.data;
                    if (t.data.isLoadMore = !0, 1 === e.result) {
                        var o = e.data.data, i = t.data.listData.concat(o);
                        t.setData({
                            listData: i
                        });
                    } else t.data.page = t.data.page - 1, t.data.isLoadMore = !1;
                }
            });
        }
    },
    onLoad: function(a) {
        a.memberId && (this.data.memberId = a.memberId), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});